package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: twer
 * Date: 5/25/13
 * Time: 12:28 AM
 * To change this template use File | Settings | File Templates.
 */
public class User {
    private String username;
    private String name;
    private String passwd;
    private String email;
    private String phone;

    public User(String username, String passwd){
        this.username = username;
        this.passwd = passwd;
    }

    public String getUsername() {
        return username;
    }

    public String getPasswd() {
        return passwd;
    }

    public String getEmail() {
        return email;
    }

    public String getPhone() {
        return phone;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        User user = (User) o;

        if (!email.equals(user.email)) return false;
        if (!passwd.equals(user.passwd)) return false;
        if (!phone.equals(user.phone)) return false;
        if (!username.equals(user.username)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = username.hashCode();
        result = 31 * result + passwd.hashCode();
        result = 31 * result + email.hashCode();
        result = 31 * result + phone.hashCode();
        return result;
    }

    public String toString(){
        StringBuilder sb = new StringBuilder();
        sb.append("User: ").append(username).append("\t").append(email).append("\t").append(phone);
        return sb.toString();
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
